package com.example.javapracticaltraining.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 膳食计划详情表
 * @TableName diet_plan_detail
 */
@TableName(value ="diet_plan_detail")
@Data
public class DietPlanDetail {
    /**
     * 
     */
    @TableId(value = "detail_id", type = IdType.AUTO)
    private Integer detailId;

    /**
     * 膳食计划ID
     */
    @TableField(value = "plan_id")
    private Integer planId;

    /**
     * 用餐日期
     */
    @TableField(value = "meal_date")
    private Date mealDate;

    /**
     * 餐次类型
     */
    @TableField(value = "meal_type")
    private Object mealType;

    /**
     * 食谱ID
     */
    @TableField(value = "recipe_id")
    private Integer recipeId;

    /**
     * 份量
     */
    @TableField(value = "portion")
    private BigDecimal portion;

    /**
     * 特殊说明
     */
    @TableField(value = "special_notes")
    private String specialNotes;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DietPlanDetail other = (DietPlanDetail) that;
        return (this.getDetailId() == null ? other.getDetailId() == null : this.getDetailId().equals(other.getDetailId()))
            && (this.getPlanId() == null ? other.getPlanId() == null : this.getPlanId().equals(other.getPlanId()))
            && (this.getMealDate() == null ? other.getMealDate() == null : this.getMealDate().equals(other.getMealDate()))
            && (this.getMealType() == null ? other.getMealType() == null : this.getMealType().equals(other.getMealType()))
            && (this.getRecipeId() == null ? other.getRecipeId() == null : this.getRecipeId().equals(other.getRecipeId()))
            && (this.getPortion() == null ? other.getPortion() == null : this.getPortion().equals(other.getPortion()))
            && (this.getSpecialNotes() == null ? other.getSpecialNotes() == null : this.getSpecialNotes().equals(other.getSpecialNotes()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getDetailId() == null) ? 0 : getDetailId().hashCode());
        result = prime * result + ((getPlanId() == null) ? 0 : getPlanId().hashCode());
        result = prime * result + ((getMealDate() == null) ? 0 : getMealDate().hashCode());
        result = prime * result + ((getMealType() == null) ? 0 : getMealType().hashCode());
        result = prime * result + ((getRecipeId() == null) ? 0 : getRecipeId().hashCode());
        result = prime * result + ((getPortion() == null) ? 0 : getPortion().hashCode());
        result = prime * result + ((getSpecialNotes() == null) ? 0 : getSpecialNotes().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", detailId=").append(detailId);
        sb.append(", planId=").append(planId);
        sb.append(", mealDate=").append(mealDate);
        sb.append(", mealType=").append(mealType);
        sb.append(", recipeId=").append(recipeId);
        sb.append(", portion=").append(portion);
        sb.append(", specialNotes=").append(specialNotes);
        sb.append("]");
        return sb.toString();
    }
}